$(document).ready(function(){ 
    if(!isAppWeb()){
        $("#foot-btn").html('<div class="sport_down_bar"></div><div class="sport_down clearfix"><div class="fl down_logo"><img src="/statics/images/logo.png"></div><div class="fl download_font"><p class="appName">运动中国APP</p><p class="titlt_sub">让我们的每个起点都有意义</p></div><div class="fr clearfix foot_operate"><a class="fl open_app" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.csda.sportschina">马上下载</a><a class="fl close_foot" href="javascript:$(\'#foot-btn\').hide();"></a></div></div>')
    }
}); 

function isIosWeb(){
    var userAgent = window.navigator.userAgent;
    userAgent = userAgent.toLocaleLowerCase();
    if(userAgent.indexOf("iphone") != -1 || userAgent.indexOf("ipad") != -1 /*|| userAgent.indexOf("mac") != -1*/){
        return true;
    }

    return false;
}
function isAndroidWeb(){
    var userAgent = window.navigator.userAgent;
    userAgent = userAgent.toLocaleLowerCase();
    if(userAgent.indexOf("android") != -1){
        return true;
    }

    return false;
}
function isWeixin(){
    var userAgent = window.navigator.userAgent;
    userAgent = userAgent.toLocaleLowerCase();
    if(userAgent.indexOf("micromessenger") != -1){
        return true;
    }

    return false;
}

function isAppWeb(version){
    var userAgent = window.navigator.userAgent;
    userAgent = userAgent.toLocaleLowerCase();
    if(userAgent.indexOf("sportchina") != -1){
        return true;
    }

    return false;
}


function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null)
        return unescape(r[2]);
    return null;
}
function setupWebViewJavascriptBridge(callback) {
  if (window.WebViewJavascriptBridge) {
      callback(WebViewJavascriptBridge);
  } else {
      document.addEventListener('WebViewJavascriptBridgeReady', function() {callback(WebViewJavascriptBridge);}, false);
  }
  window.WVJBCallbacks = [callback];
  var WVJBIframe = document.createElement('iframe');
  WVJBIframe.style.display = 'none';
  WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
  document.documentElement.appendChild(WVJBIframe);
  setTimeout(function() { document.documentElement.removeChild(WVJBIframe) }, 0)
}

function Call_NativeApp(module,type,value) {
      type = type || 2;  
      value = value || ''; 
      setupWebViewJavascriptBridge(function (bridge) {  
         bridge.callHandler('app_call', {'m': module,'t':type,'v':value}, function (responseData) {  

         });              
     })
}